package Demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-07-17
 * Time: 14:34
 */
public class Test {
    public static void main(String[] args) {
        BinaryTree tree = new BinaryTree();
        tree.createTree();
//        tree.morris(tree.root);
        tree.preOrderMorris(tree.root);
        System.out.println();
        tree.inOrderMorris(tree.root);
    }
    public static void main3(String[] args) {
        BinaryTree tree = new BinaryTree();
        tree.createTree();
        tree.preOrder2(tree.root);
        tree.inOrder2(tree.root);
        tree.postorder2(tree.root);
    }
    public static void main2(String[] args) {
        BinaryTree tree = new BinaryTree();
        tree.createTree();

        tree.preOrder(tree.root);
        System.out.println();
        tree.inOrder(tree.root);
        System.out.println();
        tree.postorder(tree.root);
        System.out.println();
        tree.nodeNum1(tree.root);
        tree.levelOrder(tree.root);
        System.out.println(tree.isCompleteTree(tree.root));
    }
    public static void main1(String[] args) {
        BinaryTree tree = new BinaryTree();
        tree.createTree();

        tree.preOrder(tree.root);
        System.out.println();
        tree.inOrder(tree.root);
        System.out.println();
        tree.postorder(tree.root);
        System.out.println();
        tree.nodeNum1(tree.root);
        System.out.println("二叉树的节点数为：" + BinaryTree.nodeNumber);
        System.out.println("二叉树的节点数为：" + tree.nodeNumber2(tree.root));
        tree.leafNum1(tree.root);
        System.out.println("二叉树的叶子节点数为：" + BinaryTree.leafNumber);
        System.out.println("二叉树的叶子节点数为：" + tree.leafNum2(tree.root));
        System.out.println("第3层的节点数为：" + tree.getKLevelNodeCount(tree.root,3));
        System.out.println("第4层的节点数为：" + tree.getKLevelNodeCount(tree.root,4));
        System.out.println("二叉树高度为：" + tree.getHeight(tree.root));
        System.out.println(tree.find(tree.root,'H').val);
    }
}
